package com.biz.primus.ms.payment.service;

import com.biz.primus.model.payment.vo.req.*;
import com.biz.primus.model.payment.vo.resp.PaymentCancelResp;
import com.biz.primus.model.payment.vo.resp.PaymentQueryRespVo;
import com.biz.primus.model.payment.vo.resp.PaymentRefundRespVo;
import com.biz.primus.model.payment.vo.resp.PaymentRespVo;
import com.biz.primus.ms.payment.channel.allinpay.res.AllInPayH5PayRespVo;
import com.biz.primus.ms.payment.channel.wechat.exceptions.PaymentException;
import com.biz.primus.ms.payment.channel.wechat.exceptions.SignIncorrectException;
import com.biz.primus.ms.payment.exception.PaymentOrderIsExpiredException;
import com.biz.primus.ms.payment.exception.PaymentOrderIsPaidException;

/**
 * Created by defei on 9/26/17.
 */
public interface PaymentService {

    /**
     * 为订单生成付款单
     */
    PaymentRespVo createPayment(PaymentReqVo paymentReqVo) throws PaymentOrderIsPaidException, PaymentOrderIsExpiredException, PaymentException;

    /**
     * 如果已经接收到第三方回调 通知成功 则直接返回，否则到调用第三方接口查询后再返回
     */
    PaymentQueryRespVo checkPaymentStatus(PaymentQueryReqVo paymentQueryVo);

    /**
     * 退款
     */
    PaymentRefundRespVo refund(PaymentRefundReqVo reqVo) throws PaymentException;

    /**
     * 退款状态查询
     */
    PaymentRefundRespVo refundQuery(PaymentRefundReqVo paymentRefundReqVo) throws PaymentException;

    /**
     * 关闭订单
     */
    void closePayment(PaymentQueryReqVo paymentQueryVo) throws PaymentOrderIsPaidException;

    /**
     * 第三方支付通知处理
     */
    void handlePaymentNotify(PaymentNotifyReqVo reqVo) throws SignIncorrectException;

    /**
     *通联H5支付回调
     */
    void handleAllInPayH5Notify(AllInPayH5PayRespVo reqVo);

    /**
     * 通联支付结果通知
     */
    String handleAllInPayNotify(AllInPayPaymentNotifyReqVo reqVo);

    /**
     * 通联撤销支付
     */
    PaymentCancelResp cancelPayment(PaymentCancelReqVo reqVo);
}
